Uri dataUri = new Uri("ms-appx:///DataModel/ControlInfoData.json");

如何加载文件资源 ms-appx ms-appx-web ms-appdata

https://msdn.microsoft.com/library/2fc07702-7022-44b7-8471-8d477a105fc5



https://github.com/Microsoft/Windows-universal-samples/blob/master/Samples/XamlUIBasics/cs/AppUIBasics/DataModel/ControlInfoDataSource.cs

https://docs.microsoft.com/en-us/uwp/api/Windows.Data.Json

// 读取 uwp 本地   json 

/****
var uri = new Windows.Foundation.Uri("ms-appx:///datafile.xml")
Windows.Storage.StorageFile.getFileFromApplicationUriAsync(uri).done
***/
//GetFileFromPathAsync //如果你的路径使用斜线，确保你使用反斜杠（）

//获取当前文件的父文件夹。StorageFile.GetParentAsync
url dataUri;

StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(dataUri);

//FileIO.ReadTextAsync(file);
//WriteTextAsync(IStorageFile, String, UnicodeEncoding)

string jsonText = await FileIO.ReadTextAsync(file);

//windows.data.json.jsonobject
JsonObject jsonObject = JsonObject.Parse(jsonText);
//建议换成 public static bool TryParse(String input, JsonObject result)
//


// [] 得到方括号的 数组 

JsonArray jsonArray = jsonObject["Groups"].GetArray();
           foreach (JsonValue groupValue in jsonArray)
                {
                    JsonObject groupObject = groupValue.GetObject();
                    ControlInfoDataGroup group = new ControlInfoDataGroup(groupObject["UniqueId"].GetString(),
                                                                          groupObject["Title"].GetString(),
                                                                          groupObject["Subtitle"].GetString(),
                                                                          groupObject["ImagePath"].GetString(),
                                                                          groupObject["Description"].GetString());


                    foreach (JsonValue itemValue in groupObject["Items"].GetArray())
                    {
                        JsonObject itemObject = itemValue.GetObject();
                        var item = new ControlInfoDataItem(itemObject["UniqueId"].GetString(),
                                                                itemObject["Title"].GetString(),
                                                                itemObject["Subtitle"].GetString(),
                                                                itemObject["ImagePath"].GetString(),
                                                                itemObject["Description"].GetString(),
                                                                itemObject["Content"].GetString());
                        if (itemObject.ContainsKey("Docs"))
                        {
                            foreach (JsonValue docValue in itemObject["Docs"].GetArray())
                            {
                                JsonObject docObject = docValue.GetObject();
                                item.Docs.Add(new ControlInfoDocLink(docObject["Title"].GetString(), docObject["Uri"].GetString()));
                            }
                        }
                        if (itemObject.ContainsKey("RelatedControls"))
                        {
                            foreach (JsonValue relatedControlValue in itemObject["RelatedControls"].GetArray())
                            {
                                item.RelatedControls.Add(relatedControlValue.GetString());
                            }
                        }
                        group.Items.Add(item);
                    }
                    if (!this.Groups.Any(g => g.Title == group.Title))
                        this.Groups.Add(group);
                }